Image compression techniques reduce the memory required for storage of large or complex images, permitting storage of images in devices with limited memory. For example, image compression techniques used in digital copiers and scanners assist in storage of complex images for subsequent printing. Similarly, image compression benefits communications where bandwidth limitations would otherwise render transmission of image data impractical. Image compression also offers substantial benefits for archiving large image libraries.
The JPEG (Joint Photographic Experts Group) standard is a set of image compression techniques that have gained widespread acceptance. The most popular of the three general compression methods defined by the JPEG standard is the baseline sequential discrete cosine transform (DCT) technique. This technique reduces the file size of grayscale and color images with a near minimum possible loss of image quality. The basic image unit for JPEG compression is the block which includes an eight pixel by eight pixel subset of the image. Each image block is analyzed and quantized, yielding DCT coefficients representative of the image block content. The coefficients are then Huffman coded to reduce the amount of data used to characterize them.
Huffman coding generally includes combining a zero run length and a magnitude length to represent the coefficients in the smallest possible number of bits. The zero run length describes the number of consecutive zero-valued coefficients preceding a non-zero coefficient. The magnitude length specifies the size (i.e., number of bits) and sign of the non-zero coefficient. The Huffman codes are based on a set of variable word length symbols. The number of bits used to represent a particular Huffman code is inversely related to the probability of encountering the run-length/magnitude length represented by that code (i.e., entropy encoding).
JPEG Huffman symbols are typically decoded by comparing a symbol to a set of stored symbols according to a "compare-add" method. If a match is found, the stored symbol is subtracted from the symbol to be decoded and the difference is added to the corresponding table offset to yield a sum. The sum is then used to address a table that holds the value of the symbol. The compare-add method can sometimes be too slow for some applications because it requires performing a large number of sequential operations.
JPEG Huffman symbols can also be decoded by comparing the symbol bit pattern to a set of stored bit patterns according to a "content-addressable-memory" (CAM) method. If a match is found, the value for that symbol is read out. The CAM method is generally faster than the compare-add method, but it requires storage for a large number of bit patterns.